#polar 1
# month 3 comparisons
Meth_vs_Nal_3<-FindMarkers(results_polar1, "Methadone_3","Naltrexone_3", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
Meth_vs_Bup.Nalo_3<-FindMarkers(results_polar1, "Methadone_3","Bup.Nalo_3", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
Bup.Nalo_vs_Nal_3<-FindMarkers(results_polar1, "Bup.Nalo_3","Naltrexone_3", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
# month 0 comparisons
Meth_vs_Nal_0<-FindMarkers(results_polar1, "Methadone_0","Naltrexone_0", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
Meth_vs_Bup.Nalo_0<-FindMarkers(results_polar1, "Methadone_0","Bup.Nalo_0", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
Bup.Nalo_vs_Nal_0<-FindMarkers(results_polar1, "Bup.Nalo_0","Naltrexone_0", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
todo<-list(Meth_vs_Nal_3,Meth_vs_Bup.Nalo_3,Bup.Nalo_vs_Nal_3,Meth_vs_Nal_0,Meth_vs_Bup.Nalo_0,Bup.Nalo_vs_Nal_0 )
names(todo)<-c("Meth_vs_Nal_3","Meth_vs_Bup.Nalo_3","Bup.Nalo_vs_Nal_3","Meth_vs_Nal_0","Meth_vs_Bup.Nalo_0","Bup.Nalo_vs_Nal_0")
for(i in 1:length(todo)){
todo[[i]]$p_val_adj<-p.adjust( todo[[i]]$p_val, "BH")
print(VolPlot( todo[[i]], Title = names(todo)[[i]]))
}
## Warning: ggrepel: 16 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 69 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 8 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 63 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 8 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
pdf("~/gibbs/DOGMAMORPH/Ranalysis/Scripts/Figure Notebooks/rawFigs/fig3/A_F.pdf", width = 16, height = 9)
for(i in 1:length(todo)){
print(VolPlot(todo[[i]], Title = names(todo)[[i]]))
}
## Warning: ggrepel: 16 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 69 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 9 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 63 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
## Warning: ggrepel: 8 unlabeled data points (too many overlaps). Consider
## increasing max.overlaps
dev.off()->.
#subset to just DE genes for these tables to avoid them being too unwieldy
DT::datatable(rownames=TRUE, filter="top", class='cell-border stripe', extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print')), data=subset(Meth_vs_Nal_3, p_val_adj<0.01))
DT::datatable(rownames=TRUE, filter="top", class='cell-border stripe', extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print')), data=subset(Meth_vs_Bup.Nalo_3, p_val_adj<0.01))
DT::datatable(rownames=TRUE, filter="top", class='cell-border stripe', extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print')), data=subset(Bup.Nalo_vs_Nal_3, p_val_adj<0.01))
DT::datatable(rownames=TRUE, filter="top", class='cell-border stripe', extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print')), data=subset(Meth_vs_Nal_0, p_val_adj<0.01))
DT::datatable(rownames=TRUE, filter="top", class='cell-border stripe', extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print')), data=subset(Meth_vs_Bup.Nalo_0, p_val_adj<0.01))
DT::datatable(rownames=TRUE, filter="top", class='cell-border stripe', extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print')), data=subset(Bup.Nalo_vs_Nal_0, p_val_adj<0.01))
#grabbing hallmark as well as the curated, immune
m_df_H<- msigdbr(species = "Homo sapiens", category = "H")
m_df_H<- rbind(msigdbr(species = "Homo sapiens", category = "C2"), m_df_H)
m_df_H<- rbind(msigdbr(species = "Homo sapiens", category = "C7"), m_df_H)
fgsea_sets<- m_df_H %>% split(x = .$gene_symbol, f = .$gs_name)
# month 3 comparisons
Meth_vs_Nal_3<-FindMarkers(results_polar1, "Methadone_3","Naltrexone_3", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
Bup.Nalo_vs_Meth_3<-FindMarkers(results_polar1, "Bup.Nalo_3","Methadone_3", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
Bup.Nalo_vs_Nal_3<-FindMarkers(results_polar1, "Bup.Nalo_3","Naltrexone_3", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
# month 0 comparisons
Meth_vs_Nal_0<-FindMarkers(results_polar1, "Methadone_0","Naltrexone_0", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
Bup.Nalo_vs_Meth_0<-FindMarkers(results_polar1, "Bup.Nalo_0","Methadone_0", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
Bup.Nalo_vs_Nal_0<-FindMarkers(results_polar1, "Bup.Nalo_0","Naltrexone_0", min.pct = -Inf, min.diff.pct = -Inf, logfc.threshold = -Inf)
todo<-list(Meth_vs_Nal_3,Bup.Nalo_vs_Meth_3,Bup.Nalo_vs_Nal_3,Meth_vs_Nal_0,Bup.Nalo_vs_Meth_0,Bup.Nalo_vs_Nal_0 )
names(todo)<-c("Meth_vs_Nal_3","Bup.Nalo_vs_Meth_3","Bup.Nalo_vs_Nal_3","Meth_vs_Nal_0","Bup.Nalo_vs_Meth_0","Bup.Nalo_vs_Nal_0")
GSEAres<-list()
for (i in 1:length(todo)){
GSEAres[[i]]<-GSEA(todo[[i]], genesets = fgsea_sets)
GSEAres[[i]]<-GSEATable(GSEAwrap_out =GSEAres[[i]], gmt = fgsea_sets, name = names(todo)[[i]] )
}
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (7.31% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## [1] "start ranking"
## [1] "done ranking"
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (6.48% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize =
## minSize, : There were 8 pathways for which P-values were not calculated
## properly due to unbalanced (positive and negative) gene-level statistic values.
## For such pathways pval, padj, NES, log2err are set to NA. You can try to
## increase the value of the argument nPermSimple (for example set it nPermSimple
## = 10000)
## [1] "start ranking"
## [1] "done ranking"
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (6.51% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize =
## minSize, : There were 9 pathways for which P-values were not calculated
## properly due to unbalanced (positive and negative) gene-level statistic values.
## For such pathways pval, padj, NES, log2err are set to NA. You can try to
## increase the value of the argument nPermSimple (for example set it nPermSimple
## = 10000)
## [1] "start ranking"
## [1] "done ranking"
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (6.11% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize =
## minSize, : There were 7 pathways for which P-values were not calculated
## properly due to unbalanced (positive and negative) gene-level statistic values.
## For such pathways pval, padj, NES, log2err are set to NA. You can try to
## increase the value of the argument nPermSimple (for example set it nPermSimple
## = 10000)
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize =
## minSize, : For some of the pathways the P-values were likely overestimated. For
## such pathways log2err is set to NA.
## [1] "start ranking"
## [1] "done ranking"
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (5.73% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## [1] "start ranking"
## [1] "done ranking"
## Warning in preparePathwaysAndStats(pathways, stats, minSize, maxSize, gseaParam, : There are ties in the preranked stats (4.5% of the list).
## The order of those tied genes will be arbitrary, which may produce unexpected results.
## Warning in fgseaMultilevel(pathways = pathways, stats = stats, minSize =
## minSize, : There were 16 pathways for which P-values were not calculated
## properly due to unbalanced (positive and negative) gene-level statistic values.
## For such pathways pval, padj, NES, log2err are set to NA. You can try to
## increase the value of the argument nPermSimple (for example set it nPermSimple
## = 10000)
## [1] "start ranking"
## [1] "done ranking"
GSEAres<-GSEAbig(listofGSEAtables = GSEAres)
to_plot<-c("GSE11057_CD4_EFF_MEM_VS_PBMC_UP","GSE8685_IL2_STARVED_VS_IL2_ACT_IL2_STARVED_CD4_TCELL_DN","BROWNE_INTERFERON_RESPONSIVE_GENES")
DT::datatable(rownames=TRUE, filter="top", class='cell-border stripe', extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = c('copy', 'csv', 'excel', 'pdf', 'print')), data=subset(GSEAres, padj<0.001))
## Warning in instance$preRenderHook(instance): It seems your data is too big for
## client-side DataTables. You may consider server-side processing:
## https://rstudio.github.io/DT/server.html